const tools = require('../helps/tools');
const routes = require('../routes');
const config = require('../config');
const should = require('should');
const mocha = require('mocha');
const coMocha = require('co-mocha');
const koa = require('koa');
const supertest = require('co-supertest');
const middlewares = require('koa-middlewares');

const app = koa();
app.use(middlewares.bodyParser());
routes.forEach((route) => {
  app.use(route.routes());
});

coMocha(mocha);
tools.extend();
module.exports = {
  app,
  should,
  request: supertest(app.listen()),
  config,
};
